use "INSERTPATH\study1.dta", clear
cd "INSERTPATH\results"

********MAIN PAPER*********
*******FIGURE 1*****
reg dominance i.candemmg, cluster(respondentid)
margins candemmg
marginsplot, recast(bar) recastci(rcap) xlabel (0 "Democratic" 1 "Undemocratic", labsize(small)) ylabel(0 .5 1)  ytitle("Dominance Impression") plot1opts(bcolor(gs6)) ci1opt(color(gs6*2)) xtitle("{bf:Difference = .20 [95% CI: .18-.21]}", size(small)) title("") legend(off)
graph display, ysize(7)
graph export study1dominance.pdf, replace

***attrition (noted in section 3.1)
gen outcome = dominance if dominance != .
replace outcome = warmth if warmth != .
replace outcome = vote if vote != .
replace outcome = competence if competence != .
recode outcome (. = 1) (else = 0), gen(attrition)
reg attrition candemmg, cluster(respondentid)


***warmth and competence tests (noted in section 3.2)
reg competence i.candemmg, cluster(respondentid)
reg warmth i.candemmg, cluster(respondentid)
reg vote i.candemmg, cluster(respondentid)



*********************APPENDIX***********************
*******FIGURE B1: ROBUSTNESS ACROSS TASKS*******
reg dominance i.candemmg##i.task, cluster(respondentid)
margins, dydx(candemmg) at(task=(1(1)10))
marginsplot, title("{bf: Robustness of Dominance Inference Across Tasks}", size(medium)) ytitle("Effects of Undemocratic Behavior on Dominance Impressions", size(small)) xtitle("") b1title("Task Number", size(small)) graphregion(margin(4 6 4 2)) xlabel(1 2 3 4 5 6 7 8 9 10) legend(position(6) size(medium)) ylabel(-.1 0 .1 .2 .3 .4, labsize(small)) yline(0)
graph save taskrobust, replace
graph export taskrobust.pdf, replace

*******FIGURE B2: ROBUSTNESS ACROSS PARTISANSHIP*******
reg dominance i.candemmg##i.partymatch, cluster(respondentid)
margins, dydx(candemmg) at(partymatch=(1(1)7))
marginsplot, title("{bf: Robustness of Dominance Inference Across Partisanship}", size(medium)) ytitle("Effects of Undemocratic Behavior on Dominance Impressions", size(small)) xtitle("") graphregion(margin(4 6 4 2)) xlabel(1 "Strong opposite" 4 "Independent" 7 "Strong same", labsize(small)) legend(position(6) size(medium)) ylabel(-.1 0 .1 .2 .3 .4, labsize(small)) yline(0)
graph save dominanceparty, replace
graph export partisanship_dominance.pdf, replace

*******FIGURE B3: ROBUSTNESS POLICY POSITIONS*******
reg dominance i.candemmg if socleft == 1, cluster(respondentid)
margins candemmg
marginsplot, recast(bar) recastci(rcap) xlabel (0 "Democratic" 1 "Undemocratic", labsize(small)) ylabel(0 .5 1)  ytitle("Dominance Impression") plot1opts(bcolor(gs6)) ci1opt(color(gs6*2)) xtitle("") title("Left-wing on Moral Issues") legend(off)
graph display, ysize(7)
graph save study1dominance_socleft, replace

reg dominance i.candemmg if socleft == 0, cluster(respondentid)
margins candemmg
marginsplot, recast(bar) recastci(rcap) xlabel (0 "Democratic" 1 "Undemocratic", labsize(small)) ylabel(0 .5 1)  ytitle("Dominance Impression") plot1opts(bcolor(gs6)) ci1opt(color(gs6*2)) xtitle("") title("Right-wing on Moral Issues") legend(off)
graph display, ysize(7)
graph save study1dominance_socright, replace

reg dominance i.candemmg if redileft == 1, cluster(respondentid)
margins candemmg
marginsplot, recast(bar) recastci(rcap) xlabel (0 "Democratic" 1 "Undemocratic", labsize(small)) ylabel(0 .5 1)  ytitle("Dominance Impression") plot1opts(bcolor(gs6)) ci1opt(color(gs6*2)) xtitle("") title("Left-wing on Redistribution") legend(off)
graph display, ysize(7)
graph save study1dominance_redileft, replace

reg dominance i.candemmg if socleft == 0, cluster(respondentid)
margins candemmg
marginsplot, recast(bar) recastci(rcap) xlabel (0 "Democratic" 1 "Undemocratic", labsize(small)) ylabel(0 .5 1)  ytitle("Dominance Impression") plot1opts(bcolor(gs6)) ci1opt(color(gs6*2)) xtitle("") title("Right-wing on Redistribution") legend(off)
graph display, ysize(7)
graph save study1dominance_rediright, replace

graph combine study1dominance_redileft.gph study1dominance_rediright.gph study1dominance_socleft.gph study1dominance_socright.gph, col(2) title("Robustness Across Candidate Policy Positions")
graph display, ysize(8) xsize(7)
graph export policy_robustness.pdf, replace





*******AGGRESSION PILOT STUDY (APPENDIX C)*********
use "INSERTPATH\pilot_aggression.dta", clear
**FIGURE C1
reg undemocratic1 i.Item1, cluster(respondentid)
eststo uItem1
reg aggressive1 i.Item1, cluster(respondentid)
eststo aItem1

reg undemocratic2 i.Item2, cluster(respondentid)
eststo uItem2
reg aggressive2 i.Item2, cluster(respondentid)
eststo aItem2

reg undemocratic3 i.Item3, cluster(respondentid)
eststo uItem3
reg aggressive3 i.Item3, cluster(respondentid)
eststo aItem3

reg undemocratic4 i.Item4, cluster(respondentid)
eststo uItem4
reg aggressive4 i.Item4, cluster(respondentid)
eststo aItem4

reg undemocratic5 i.Item5, cluster(respondentid)
eststo uItem5
reg aggressive5 i.Item5, cluster(respondentid)
eststo aItem5

reg undemocratic6 i.Item6, cluster(respondentid)
eststo uItem6
reg aggressive6 i.Item6, cluster(respondentid)
eststo aItem6

reg undemocratic7 i.Item7, cluster(respondentid)
eststo uItem7
reg aggressive7 i.Item7, cluster(respondentid)
eststo aItem7

reg undemocratic8 i.Item8, cluster(respondentid)
eststo uItem8
reg aggressive8 i.Item8, cluster(respondentid)
eststo aItem8

reg undemocratic9 i.Item9, cluster(respondentid)
eststo uItem9
reg aggressive9 i.Item9, cluster(respondentid)
eststo aItem9

reg undemocratic10 i.Item10, cluster(respondentid)
eststo uItem10
reg aggressive10 i.Item10, cluster(respondentid)
eststo aItem10

reg undemocratic11 i.Item11, cluster(respondentid)
eststo uItem11
reg aggressive11 i.Item11, cluster(respondentid)
eststo aItem11

reg undemocratic12 i.Item12, cluster(respondentid)
eststo uItem12
reg aggressive12 i.Item12, cluster(respondentid)
eststo aItem12

reg undemocratic13 i.Item13, cluster(respondentid)
eststo uItem13
reg aggressive13 i.Item13, cluster(respondentid)
eststo aItem13

reg undemocratic14 i.Item14, cluster(respondentid)
eststo uItem14
reg aggressive14 i.Item14, cluster(respondentid)
eststo aItem14

reg undemocratic15 i.Item15, cluster(respondentid)
eststo uItem15
reg aggressive15 i.Item15, cluster(respondentid)
eststo aItem15

reg undemocratic16 i.Item16, cluster(respondentid)
eststo uItem16
reg aggressive16 i.Item16, cluster(respondentid)
eststo aItem16

reg undemocratic17 i.Item17, cluster(respondentid)
eststo uItem17
reg aggressive17 i.Item17, cluster(respondentid)
eststo aItem17

reg undemocratic18 i.Item18, cluster(respondentid)
eststo uItem18
reg aggressive18 i.Item18, cluster(respondentid)
eststo aItem18

reg undemocratic19 i.Item19, cluster(respondentid)
eststo uItem19
reg aggressive19 i.Item19, cluster(respondentid)
eststo aItem19

reg undemocratic20 i.Item20, cluster(respondentid)
eststo uItem20
reg aggressive20 i.Item20, cluster(respondentid)
eststo aItem20

reg undemocratic21 i.Item21, cluster(respondentid)
eststo uItem21
reg aggressive21 i.Item21, cluster(respondentid)
eststo aItem21

reg undemocratic22 i.Item22, cluster(respondentid)
eststo uItem22
reg aggressive22 i.Item22, cluster(respondentid)
eststo aItem22

reg undemocratic23 i.Item23, cluster(respondentid)
eststo uItem23
reg aggressive23 i.Item23, cluster(respondentid)
eststo aItem23

reg undemocratic24 i.Item24, cluster(respondentid)
eststo uItem24
reg aggressive24 i.Item24, cluster(respondentid)
eststo aItem24

reg undemocratic25 i.Item25, cluster(respondentid)
eststo uItem25
reg aggressive25 i.Item25, cluster(respondentid)
eststo aItem25

reg undemocratic26 i.Item26, cluster(respondentid)
eststo uItem26
reg aggressive26 i.Item26, cluster(respondentid)
eststo aItem26

reg undemocratic27 i.Item27, cluster(respondentid)
eststo uItem27
reg aggressive27 i.Item27, cluster(respondentid)
eststo aItem27

coefplot (uItem1,label(Item 1)) uItem2 uItem3 uItem4 uItem5 uItem6 uItem7 uItem8 uItem9 uItem10 uItem11 uItem12 uItem13 uItem14 uItem15 uItem16 uItem17 uItem18 uItem19 uItem20 uItem21 uItem22 uItem23 uItem24 uItem25 uItem26 uItem27, drop(_cons) xline(0) msymbol(o) mcolor(black) ciopts(color(black)) title("Undemocraticness") legend(off) nolabels
graph save undemocraticness, replace
coefplot aItem1 aItem2 aItem3 aItem4 aItem5 aItem6 aItem7 aItem8 aItem9 aItem10 aItem11 aItem12 aItem13 aItem14 aItem15 aItem16 aItem17 aItem18 aItem19 aItem20 aItem21 aItem22 aItem23 aItem24 aItem25 aItem26 aItem27, drop(_cons) xline(0) msymbol(o) mcolor(black) ciopts(color(black)) title("Aggression") legend(off) nolabels
graph save aggression, replace
graph combine undemocraticness.gph aggression.gph
graph display, ysize(8.5) xsize(7)
graph export "INSERTPATH\LL_KVSF_conjoints\Results\pilot.pdf", replace

********FIGURE C2*******
coefplot uItem3 uItem14 uItem17 uItem24, drop(_cons) xline(0) msymbol(o) mcolor(black) ciopts(color(black)) title("Undemocraticness (pilot)") legend(off) nolabels
graph save undemocraticness0, replace
coefplot aItem3 aItem14 aItem17 aItem24, drop(_cons) xline(0) msymbol(o) mcolor(black) ciopts(color(black)) title("Aggression (pilot)") legend(off) nolabels
graph save aggression0, replace


gen undemocratic3_14 = (undemocratic3+undemocratic14)/2
gen undemocratic17_24 = (undemocratic17+undemocratic24)/2
gen aggressive3_14 = (aggressive3+aggressive14)/2
gen aggressive17_24 = (aggressive17+aggressive24)/2
gen I17_24 = (Item17+Item24)/2
gen I3_14 = (Item3+Item14)/2

reg undemocratic3_14 I3_14, cluster(respondentid)
eststo unnonagg
reg undemocratic17_24 I17_24, cluster(respondentid)
eststo unagg
reg aggressive3_14 I3_14, cluster(respondentid)
eststo agnonagg
reg aggressive17_24 I17_24, cluster(respondentid)
eststo agagg
coefplot (unnonagg,label("Non-aggressive")) (unagg,label(Aggressive)), drop(_cons) xline(0) msymbol(o) mcolor(black) ciopts(color(black)) title("Undemocraticness (pilot)") legend(off) nolabels
graph save undemocraticness1, replace
coefplot (agnonagg,label(Non-aggressive)) (agagg,label(Aggressive)), drop(_cons) xline(0) msymbol(o) mcolor(black) ciopts(color(black)) title("Aggression (pilot)") legend(off) nolabels
graph save aggressive1, replace



*Add dominance-results
use "INSERTPATH\study1.dta", clear
rename item3 Item3
rename item14 Item14
rename item17 Item17 
rename item24 Item24 
rename aggressives I17_24 
rename nonaggressives I3_14
reg dominance i.Item3, cluster(respondentid)
eststo item3
reg dominance i.Item14, cluster(respondentid)
eststo item14
reg dominance i.Item17, cluster(respondentid)
eststo item17
reg dominance i.Item24, cluster(respondentid)
eststo item24
reg dominance i.I17_24, cluster(respondentid)
eststo aggressives
reg dominance i.I3_14, cluster(respondentid)
eststo nonaggressives
coefplot item3 item14 item17 item24, drop(_cons) xline(0) msymbol(o) mcolor(black) ciopts(color(black)) title("Dominance (conjoint)") legend(off) nolabels
graph save dominance2, replace
coefplot nonaggressives aggressives, drop(_cons) xline(0) msymbol(o) mcolor(black) ciopts(color(black)) title("Dominance (conjoint)") legend(off) nolabels
graph save dominance22, replace
graph combine undemocraticness0.gph undemocraticness1.gph aggression0.gph aggressive1.gph dominance2.gph dominance22.gph, cols(2) xcommon
graph display, ysize(8.5) xsize(7)
graph export "INSERTPATH\figureC2.pdf", replace